template<class T_rst>
T_rst u8Unicode( const void* _utf8, LccToolbox::block<T_rst>* unicodeline, size_t remainedCount){
	const unsigned char* utf8=(const unsigned char*)_utf8;
	if(!remainedCount) remainedCount=strlen((const char*)utf8);
	if(!remainedCount) return 0;

	T_rst rst=0,temp=0;// for decompose
	unsigned char stridebyte=0;
	while(((utf8[0]<<stridebyte)&255)>128) ++stridebyte;
	if(!stridebyte)// ASCII
	{	rst=(T_rst)(utf8[0]);
		if(unicodeline)
		{	unicodeline->insert(unicodeline->size(),&rst,1);
			if(--remainedCount) u8Unicode(utf8+1,unicodeline,remainedCount);
		}
		return rst;
	}
	if(stridebyte>6||stridebyte>remainedCount) return 0;// max is 6
	// if(sizeof(T_rst)*8<=stridebyte*8-(stridebyte+1+(stridebyte-1)*2)) return 0;// T_rst can't hold the unicode
	if(sizeof(T_rst)*8<stridebyte*5+1) return 0;// simplify above

	// un ASCII case
	unsigned char i=0;
	while(--stridebyte)
	{	temp=((utf8[stridebyte]<<1)&255)>>1;// 2 mean [1]0......
		rst|=temp<<(i++*6);// 6 mean 10[......]
	}
	temp=((utf8[0]<<(++i))&255)>>i;
	rst|=temp<<(--i*6);
	if(unicodeline)
	{	unicodeline->insert(unicodeline->size(),&rst,1);
		if(remainedCount>++i) u8Unicode(utf8+i,unicodeline,remainedCount-i);
	}

	return rst;
}
